﻿<ResourceDictionary 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"    
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:local="clr-namespace:CoolCode.Controls"
  xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
  >
    <Style TargetType="local:ImageButton">
        <!-- key lines to enable the control -->
        <Setter Property="IsEnabled" Value="true" />
        <Setter Property="IsTabStop" Value="true" />
        <Setter Property="Cursor" Value="Hand" />

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:ImageButton">
                    <Grid x:Name="Root" Margin="0" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
                        <Image x:Name="normalBlock" Source="{TemplateBinding NormalImage}"/>
                        <Image x:Name="hoverBlock" Source="{TemplateBinding HoverImage}" Opacity="0"/>
                        <Image x:Name="clickBlock" Source="{TemplateBinding ClickImage}" Opacity="0"/>
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="FocusStates">
                                <vsm:VisualState x:Name="Unfocused"/>
                                <vsm:VisualState x:Name="Focused"/>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualStateGroup.Transitions>
                                    <vsm:VisualTransition GeneratedDuration="00:00:0.5" To="MouseOver"/>
                                    <vsm:VisualTransition GeneratedDuration="00:00:0.1" To="Pressed"/>
                                </vsm:VisualStateGroup.Transitions>
                                <vsm:VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="normalBlock" Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.3"/>
                                        <DoubleAnimation Storyboard.TargetName="hoverBlock" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.2"/>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="normalBlock" Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.3"/>
                                        <DoubleAnimation Storyboard.TargetName="hoverBlock" Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.3"/>
                                        <DoubleAnimation Storyboard.TargetName="clickBlock" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.3"/>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Disabled" />
                                <vsm:VisualState x:Name="Normal" />
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:DialogPanel">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:DialogPanel">
                    <Canvas>
                        <Grid x:Name="root" RenderTransformOrigin="0.5,0.5">
                            <Grid.RenderTransform>
                                <ScaleTransform ScaleX="0" ScaleY="0"/>
                            </Grid.RenderTransform>
                            <Rectangle Fill="{TemplateBinding Background}" StrokeThickness="1" Stroke="#99bbe8" RadiusX="2" RadiusY="2"></Rectangle>
                            <Grid Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"></RowDefinition>
                                    <RowDefinition Height="*"></RowDefinition>
                                </Grid.RowDefinitions>
                                <Grid x:Name="Header" Cursor="Hand">
                                    <Border Margin="2">
                                        <Border.Background>
                                            <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                                <GradientStop Color="#dae6f4" Offset="0"/>
                                                <GradientStop Color="#d4e2f4" Offset="0.5"/>
                                                <GradientStop Color="#abc7ec" Offset="0.51"/>
                                                <GradientStop Color="#bcd2ef" Offset="1"/>
                                            </LinearGradientBrush>
                                        </Border.Background>
                                    </Border>
                                    <Border Background="#99bbe8" Height="1" VerticalAlignment="Bottom"></Border>
                                    <TextBlock Margin="5"  
                                           Text="{TemplateBinding Title}" 
                                           VerticalAlignment="Center"                                           
                                           FontSize="13"
                                           >
                                    </TextBlock>
                                    <local:ImageButton x:Name="close" Width="13" Height="12" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="7"
                                                       NormalImage="/CoolCode.Controls;component/Images/ico_close.png"
                                                       HoverImage="/CoolCode.Controls;component/Images/ico_close_hover.png"
                                                       ClickImage="/CoolCode.Controls;component/Images/ico_close_click.png"/>
                                </Grid>
                                <Border Background="#dfe8f6" Margin="1" Grid.Row="1" CornerRadius="2">
                                    <ContentPresenter x:Name="ContentPresenterElement"  Margin="2"
                                              Content="{TemplateBinding Content}" 
                                              ContentTemplate="{TemplateBinding ContentTemplate}"/>
                                </Border>

                            </Grid>
                        </Grid>
                        <Canvas.Resources>
                            <Storyboard x:Name="storyboard">
                                <DoubleAnimation Storyboard.TargetName="root" Storyboard.TargetProperty="(UIElement.RenderTransform).ScaleTransform.ScaleX" From="0.3" To="1" Duration="0:0:0.4"/>
                                <DoubleAnimation Storyboard.TargetName="root" Storyboard.TargetProperty="(UIElement.RenderTransform).ScaleTransform.ScaleY" From="0.3" To="1" Duration="0:0:0.2"/>
                                <DoubleAnimation Storyboard.TargetName="root" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:0.6"/>
                            </Storyboard>
                        </Canvas.Resources>
                    </Canvas>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style TargetType="local:VisualPager">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:VisualPager">
                    <Grid x:Name="root" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" Cursor="Hand">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="auto"/>
                            <ColumnDefinition Width="10"/>
                            <ColumnDefinition Width="auto"/>
                            <ColumnDefinition Width="10"/>
                            <ColumnDefinition Width="auto"/>
                            <ColumnDefinition Width="10"/>
                            <ColumnDefinition Width="auto"/>
                            <ColumnDefinition Width="10"/>
                            <ColumnDefinition Width="auto"/>
                            <ColumnDefinition Width="10"/>
                            <ColumnDefinition Width="auto"/>
                        </Grid.ColumnDefinitions>
                        <local:ImageButton Grid.Column="0" x:Name="first" Width="15" Height="21"
                                                       NormalImage="/CoolCode.Controls;component/Images/arrow_Left_normal2.png"
                                                       HoverImage="/CoolCode.Controls;component/Images/arrow_Left_hover2.png"
                                                       ClickImage="/CoolCode.Controls;component/Images/arrow_Left_click2.png"/>
                        <local:ImageButton Grid.Column="2" x:Name="pre" Width="15" Height="21"
                                                       NormalImage="/CoolCode.Controls;component/Images/arrow_Left_normal.png"
                                                       HoverImage="/CoolCode.Controls;component/Images/arrow_Left_hover.png"
                                                       ClickImage="/CoolCode.Controls;component/Images/arrow_Left_click.png"/>
                        <local:ImageButton Grid.Column="6" x:Name="next" Width="15" Height="21"
                                                       NormalImage="/CoolCode.Controls;component/Images/arrow_Right_normal.png"
                                                       HoverImage="/CoolCode.Controls;component/Images/arrow_Right_hover.png"
                                                       ClickImage="/CoolCode.Controls;component/Images/arrow_Right_click.png"/>
                        <local:ImageButton Grid.Column="8" x:Name="last" Width="15" Height="21"
                                                       NormalImage="/CoolCode.Controls;component/Images/arrow_Right_normal2.png"
                                                       HoverImage="/CoolCode.Controls;component/Images/arrow_Right_hover2.png"
                                                       ClickImage="/CoolCode.Controls;component/Images/arrow_Right_click2.png"/>
                        <TextBlock x:Name="position" Grid.Column="10" FontSize="13"/>
                        <Canvas Grid.Column="4" x:Name="numbersCanvas" VerticalAlignment="Top">
                            <Border x:Name="block" BorderThickness="1" Background="White" Margin="0,-2,0,0"/>
                            <StackPanel x:Name="numbersPanel" Orientation="Horizontal"/>
                            <Canvas.Resources>
                                <Storyboard x:Name="storyboard">
                                    <DoubleAnimation Storyboard.TargetName="numbersPanel" Storyboard.TargetProperty="(Canvas.Left)" Duration="0:0:0.4"/>
                                    <DoubleAnimation Storyboard.TargetName="block" Storyboard.TargetProperty="(Canvas.Left)" Duration="0:0:0.6"/>
                                    <DoubleAnimation Storyboard.TargetName="block" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:1"/>
                                    <DoubleAnimation Storyboard.TargetName="numbersPanel" Storyboard.TargetProperty="Opacity" Duration="0:0:0.6"/>
                                </Storyboard>
                            </Canvas.Resources>
                        </Canvas>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style  TargetType="local:GlassButton" >
        <Setter Property="Background" Value="Blue"/>
        <Setter Property="Foreground" Value="#FFFFFFFF"/>
        <Setter Property="Padding" Value="3"/>
        <Setter Property="BorderThickness" Value="0.5" />
        <Setter Property="BorderBrush">
            <Setter.Value>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FF494990" Offset="0"/>
                    <GradientStop Color="#FF8399A9" Offset="0.375"/>
                    <GradientStop Color="#FF718597" Offset="0.375"/>
                    <GradientStop Color="#FF617584" Offset="1"/>
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="Template" >
            <Setter.Value>
                <ControlTemplate TargetType="local:GlassButton">
                    <Grid Cursor="Hand">
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualState x:Name="Normal"/>
                                <vsm:VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="glow" Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Pressed">

                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetName="border" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)">
                                            <SplineColorKeyFrame KeyTime="0" Value="#CC000000"/>
                                        </ColorAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="shine" Storyboard.TargetProperty="Opacity">
                                            <SplineDoubleKeyFrame KeyTime="0" Value="0.4"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="glow" 
												Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Disabled">
                                    <!-- <Storyboard>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="Opacity">
												<SplineDoubleKeyFrame KeyTime="0" Value=".55"/>
											</DoubleAnimationUsingKeyFrames>
										</Storyboard> -->
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="FocusStates">
                                <vsm:VisualState x:Name="Focused">
                                    <!--<Storyboard>
											<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="glow" Storyboard.TargetProperty="(UIElement.Opacity)">
												<SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/>
											</DoubleAnimationUsingKeyFrames>
										</Storyboard>-->
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Unfocused"/>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>
                        <Border BorderBrush="#FFFFFFFF" BorderThickness="1,1,1,1" CornerRadius="4,4,4,4">
                            <Border x:Name="border" Background="#7F000000" BorderBrush="#FF000000" BorderThickness="1,1,1,1" CornerRadius="4,4,4,4">
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="0.507*"/>
                                        <RowDefinition Height="0.493*"/>
                                    </Grid.RowDefinitions>
                                    <Border Opacity="0" HorizontalAlignment="Stretch" x:Name="glow" Width="Auto" Grid.RowSpan="2" CornerRadius="4,4,4,4">
                                        <Border.Background>
                                            <RadialGradientBrush>
                                                <RadialGradientBrush.RelativeTransform>
                                                    <TransformGroup>
                                                        <ScaleTransform ScaleX="1.702" ScaleY="2.243"/>
                                                        <SkewTransform AngleX="0" AngleY="0"/>
                                                        <RotateTransform Angle="0"/>
                                                        <TranslateTransform X="-0.368" Y="-0.152"/>
                                                    </TransformGroup>
                                                </RadialGradientBrush.RelativeTransform>
                                                <GradientStop Color="#B28DBDFF" Offset="0"/>
                                                <GradientStop Color="#008DBDFF" Offset="1"/>
                                            </RadialGradientBrush>
                                        </Border.Background>
                                    </Border>
                                    <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Width="Auto" Grid.RowSpan="2"/>
                                    <Border HorizontalAlignment="Stretch" Margin="0,0,0,0" x:Name="shine" Width="Auto" CornerRadius="4,4,0,0">
                                        <Border.Background>
                                            <LinearGradientBrush EndPoint="0.494,0.889" StartPoint="0.494,0.028">
                                                <GradientStop Color="#99FFFFFF" Offset="0"/>
                                                <GradientStop Color="#33FFFFFF" Offset="1"/>
                                            </LinearGradientBrush>
                                        </Border.Background>
                                    </Border>
                                </Grid>
                            </Border>
                        </Border>

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:IguazuButton">
        <Setter Property="Template" >
            <Setter.Value>
                <ControlTemplate TargetType="local:IguazuButton">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition> </RowDefinition>
                            <RowDefinition></RowDefinition>
                        </Grid.RowDefinitions>
                            <local:GlassButton x:Name="MainButton"  Content="{TemplateBinding Content}" Grid.Row="0"  ></local:GlassButton >
                            <local:GlassButton Opacity="0.7"  Content="{TemplateBinding Content}"  Grid.Row="1">
                                <local:GlassButton.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform ScaleY="0.75"></ScaleTransform>
                                        <SkewTransform AngleX="-15"></SkewTransform>
                                        <TranslateTransform Y="0" X="0"></TranslateTransform>
                                    </TransformGroup>
                                </local:GlassButton.RenderTransform>
                                <local:GlassButton.OpacityMask>
                                    <LinearGradientBrush StartPoint="0.5,0.0" EndPoint="0.5,1.0">
                                        <GradientStop Offset="0.0" Color="#FF000000" />
                                        <GradientStop Offset="1.0" Color="#00000000" />
                                    </LinearGradientBrush>
                                </local:GlassButton.OpacityMask>
                            </local:GlassButton>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:CoTabItem">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:CoTabItem">
                    <Grid Cursor="Hand">
                        <StackPanel  Orientation="Horizontal">
                            <Border CornerRadius="3" Height="24" BorderBrush="#8db2e3" Margin="2,1,1,1" BorderThickness="1,1,1,0" HorizontalAlignment="Left">
                                <Border.Background>
                                    <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                        <GradientStop Color="#ffffff" Offset="0"/>
                                        <GradientStop Color="#deecfd" Offset="1"/>
                                    </LinearGradientBrush>
                                </Border.Background>

                                <StackPanel  Orientation="Horizontal">
                                    <StackPanel.OpacityMask>
                                        <LinearGradientBrush StartPoint="0.5,0.0" EndPoint="0.5,1.0">
                                            <GradientStop Offset="0.0" Color="#00000000" />
                                            <GradientStop Offset="1.0" Color="#FF000000" />
                                        </LinearGradientBrush>
                                    </StackPanel.OpacityMask>
                                    <Border    
                                        OpacityMask="{TemplateBinding OpacityMask}"
                                        Margin="1" CornerRadius="2" >
                                        <Border.BorderBrush>
                                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                <GradientStop Color="#FF494990" Offset="0"/>
                                                <GradientStop Color="#FF8399A9" Offset="0.375"/>
                                                <GradientStop Color="#FF718597" Offset="0.375"/>
                                                <GradientStop Color="#FF617584" Offset="1"/>
                                            </LinearGradientBrush>
                                        </Border.BorderBrush>
                                        <ContentPresenter x:Name="ContentPresenterElement"  Margin="2"
                                              Content="{TemplateBinding Header}" 
                                              ContentTemplate="{TemplateBinding HeaderTemplate}">
                                        </ContentPresenter>
                                    </Border>
                                    <local:ImageButton x:Name="close" Width="13" Height="12" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="7"
                                                       NormalImage="/CoolCode.Controls;component/Images/ico_close.png"
                                                       HoverImage="/CoolCode.Controls;component/Images/ico_close_hover.png"
                                                       ClickImage="/CoolCode.Controls;component/Images/ico_close_click.png"  />

                                </StackPanel>
                            </Border>
                        </StackPanel >
                        <Grid x:Name="MaskGrid" Background="Black" Opacity="0.2"></Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>


